from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query




class MonitorModel(BaseModel):
    """
    监控管理表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    monitor_id: Optional[int] = Field(default=None, description='')
    device_id: Optional[str] = Field(default=None, description='设备ID')
    monitor_type: Optional[str] = Field(default=None, description='监控类型（smoking、drinking）')
    file_url: Optional[str] = Field(default=None, description='监控文件地址')
    file_type: Optional[str] = Field(default=None, description='监控文件类型')
    file_name: Optional[str] = Field(default=None, description='监控文件名')
    create_by: Optional[str] = Field(default=None, description='')
    create_time: Optional[datetime] = Field(default=None, description='')
    update_by: Optional[str] = Field(default=None, description='')
    update_time: Optional[datetime] = Field(default=None, description='')
    status: Optional[str] = Field(default=None, description='解析状态（0-未解析、1-已解析）')
    content: Optional[str] = Field(default=None, description='解析内容（')

class MonitorQueryModel(MonitorModel):
    """
    监控管理不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class MonitorPageQueryModel(MonitorQueryModel):
    """
    监控管理分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeleteMonitorModel(BaseModel):
    """
    删除监控管理模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    monitor_ids: str = Field(description='需要删除的')
